package control;

import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;


public class DBUtils {
	
	//��ȡ���ݿ�����
	public static Connection getCon() throws Exception {
		// ����Դ�ļ�תΪ��
		InputStream in = DBUtils.class.getClassLoader().getResourceAsStream("jdbc.properties");
		Properties pro = new Properties();
		pro.load(in);
		
		//����Դ�ļ����ж�ȡ��Ҫ������
		String driver = pro.getProperty("driver");
		String con_url = pro.getProperty("con_url");
		
		// ���ӵ����ݿ�
		Class.forName(driver);
		String url = con_url;
		Connection con = DriverManager.getConnection(url, "root", "123456");
		return con;
	}
}
